// 问题接口
import { http } from "@/utils/http";
import { baseUrlApi } from "./utils";
import { formatToken, getToken } from "@/utils/auth";

export type AddQstnResult = {
  success: boolean;
  data: {
    qstn_id: number; // 问题主键，整数
  };
};

// 添加问题接口
export const addQstn = (data?: object) => {
  const userInfo = getToken();
  return http.request<AddQstnResult>(
    "post",
    baseUrlApi("addQstn"),
    { data },
    {
      headers: {
        access_token: formatToken(userInfo.accessToken)
      }
    }
  );
};
